package models;

import static com.google.common.base.Objects.toStringHelper;

import com.google.common.base.Objects;

public class Location {
	 public Long id;      
	  public float latitude ; 
	  public float longitude; 
	  static long counter = 0l;
	  
	  public Location(){
		  
	  }
	  
	  public Location(float latitude,float longitude){
		  this.id = counter ++;
		  this.latitude = latitude;
		  this.longitude = longitude;
	  }
	  
	  @Override
	  public String toString()
	  {
	    return toStringHelper(this).addValue(id)
	    						   .addValue(latitude)
	                               .addValue(longitude)
	                               .toString();
	  }
	  
	  @Override  
	  public int hashCode()  
	  {  
	     return Objects.hashCode(this.id, this.latitude, this.latitude);  
	  } 
	  
	  @Override
	  public boolean equals(final Object obj)
	  {
	    if (obj instanceof Location)
	    {
	      final Location other = (Location) obj;
	      return Objects.equal(latitude, other.latitude) 
	          && Objects.equal(longitude, other.longitude);
	    }
	    else
	    {
	      return false;
	    }
	  }

}
